<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div class="show"></div>
    <script>
        show()
        setInterval(show,1000)
        function show(){
            var show = document.querySelector(".show")
            var time = '2021/10/22   16:50:00';
            // var time1 = '2021:10:22   16:50:00';
            // time1 = time1.replace(/\s/g,"-").split("-")[0].replace(/:/g,"-");
            // console.log(time1);
            var nowTime = +new Date()
            var endTime = +new Date(time);
            var gapTime = (endTime-nowTime)/1000;
            // console.log(gapTime)
            var d = Math.floor(gapTime/60/60/24);
            // console.log(d)
            var h = Math.floor(gapTime/60/60%24);
            // console.log(h)
            var m = Math.floor(gapTime/60%60);
            var s = Math.floor(gapTime%60);
            var sum = handleNum(d)+":"+handleNum(h)+":"+handleNum(m)+":"+handleNum(s)
            show.innerHTML = sum;
        }
        function handleNum(num){
            num = num<10?'0'+num:num;
            return num;
        }
    </script>
</body>
</html>